#!/bin/sh

# 复制项目的文件到对应docker路径，便于一键生成镜像。
usage() {
	echo "Usage: sh copy.sh"
	exit 1
}

echo "begin package "
#打包开始
cd ..
mvn clean install -Dmaven.test.skip=true
#前端
cd ./agan-ui
npm install --registry=https://registry.npmmirror.com
npm run build:prod
cd ../docker


# copy sql
echo "begin copy sql "
cp ../sql/ag_base.sql ./mysql/db
cp ../sql/ag_config.sql ./mysql/db

# copy html
echo "begin copy html "
mkdir -p ./nginx/html
cp -r ../agan-ui/dist/** ./nginx/html


# copy jar
echo "begin copy agan-gateway "
cp ../agan-register/target/agan-register.jar ./agan/register/jar

echo "begin copy agan-gateway "
cp ../agan-gateway/target/agan-gateway.jar ./agan/gateway/jar

echo "begin copy agan-auth "
cp ../agan-auth/target/agan-auth.jar ./agan/auth/jar

echo "begin copy agan-visual "
cp ../agan-visual/agan-monitor/target/agan-visual-monitor.jar  ./agan/visual/monitor/jar

echo "begin copy agan-modules-system "
cp ../agan-modules/agan-system/target/agan-modules-system.jar ./agan/modules/system/jar

echo "begin copy agan-modules-file "
cp ../agan-modules/agan-file/target/agan-modules-file.jar ./agan/modules/file/jar

echo "begin copy agan-modules-job "
cp ../agan-modules/agan-job/target/agan-modules-job.jar ./agan/modules/job/jar

echo "begin copy agan-modules-gen "
cp ../agan-modules/agan-gen/target/agan-modules-gen.jar ./agan/modules/gen/jar

